/* Room Page Specific Styles */

/* Room Container */
.room-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Room Header */
.room-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-lg) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.room-title h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-xs);
}

.room-info {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.room-actions {
    display: flex;
    gap: var(--spacing-md);
}

.room-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Messages */
.message {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}

.message-own {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    flex-direction: row-reverse;
}

.message-other {
    align-self: flex-start;
    background-color: var(--bg-light);
}

.message-system {
    align-self: center;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-style: italic;
    max-width: 60%;
    text-align: center;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-author {
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.message-text {
    word-wrap: break-word;
    line-height: 1.4;
}

.message-time {
    font-size: var(--font-size-xs);
    opacity: 0.7;
    margin-top: var(--spacing-xs);
}

/* Message Input */
.message-input-container {
    border-top: 1px solid var(--border-light);
    padding: var(--spacing-lg);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.message-form {
    display: flex;
    gap: var(--spacing-md);
}

.message-form input {
    flex: 1;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
}

.message-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-content {
    padding: var(--spacing-lg);
    flex: 1;
    overflow-y: auto;
}

.sidebar h3 {
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.user-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: var(--font-size-sm);
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.user-status {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.user-online {
    color: var(--success-color);
}

/* Invite Link Container */
.invite-link-container {
    display: flex;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.invite-link-container input {
    flex: 1;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-light);
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--warning-color);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.connection-status.connected {
    background: var(--success-color);
    color: white;
}

.connection-status.disconnected {
    background: var(--danger-color);
    color: white;
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.messages-container::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .room-header {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
        padding: var(--spacing-md);
    }
    
    .room-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-light);
        max-height: 300px;
    }
    
    .message {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .room-header {
        padding: var(--spacing-sm);
    }
    
    .messages-container {
        padding: var(--spacing-sm);
    }
    
    .message-input-container {
        padding: var(--spacing-md);
    }
    
    .sidebar-content {
        padding: var(--spacing-md);
    }
}

/* Print Styles */
@media print {
    .room-header,
    .sidebar,
    .message-input-container,
    .connection-status {
        display: none;
    }
    
    .messages-container {
        height: auto;
        overflow: visible;
    }
    
    .room-content {
        flex-direction: column;
    }
}

/* Recovery and Connection Status */
.recovery-message {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    margin: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.recovery-message h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-xl);
}

.recovery-message p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-lg) auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.connection-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.connection-status.connected {
    background-color: rgba(34, 197, 94, 0.1);
    color: #059669;
}

.connection-status.disconnected {
    background-color: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.connection-status.reconnecting {
    background-color: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.connection-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

.connection-indicator.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Error Display Enhancements */
.error-display {
    background: var(--bg-primary);
    padding: var(--spacing-xl);
    text-align: center;
    border-radius: var(--border-radius-lg);
    margin: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.error-display h3 {
    color: var(--error-color);
    margin-bottom: var(--spacing-md);
}

.error-display p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.error-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Loading Screen Enhancements */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-primary);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid var(--border-light);
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-xl);
}

.loading-text {
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-md);
}

.loading-subtext {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
}